home *** CD-ROM | disk | FTP | other *** search
/ Fine Art Gallery Builder / Fine Art Gallery Builder.iso / pc / Fine_Art_Library / customArt.swf / scripts / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2005-06-16  |  2.0 KB  |  63 lines

  1. function loadCustomArtwork(aPath, aArtworkID)
  2. {
  3.    var vXmlFile = aPath + aArtworkID + ".xml";
  4.    trace("customXML: " + vXmlFile);
  5.    ARTWORK_xml = new XML();
  6.    ARTWORK_xml.ignoreWhite = true;
  7.    ARTWORK_xml.load(vXmlFile);
  8.    ARTWORK_xml.onLoad = function(isSuccess)
  9.    {
  10.       if(isSuccess)
  11.       {
  12.          var _loc5_ = this.firstChild;
  13.          if(_loc5_.nodeName = "CUSTOM_ART")
  14.          {
  15.             var _loc6_ = _loc5_.childNodes.length;
  16.             var _loc3_ = 0;
  17.             while(_loc3_ < _loc6_)
  18.             {
  19.                var _loc2_ = _loc5_.childNodes[_loc3_];
  20.                var _loc4_ = _loc2_.nodeName;
  21.                switch(_loc4_)
  22.                {
  23.                   case "IMAGE":
  24.                      imageFile = aPath + _loc2_.attributes.file;
  25.                      vImageWidth = parseInt(_loc2_.attributes.width);
  26.                      vImageHeight = parseInt(_loc2_.attributes.height);
  27.                      if(vImageWidth < vImageHeight)
  28.                      {
  29.                         aspectRatioType = "portait";
  30.                         shortDimension = vImageWidth;
  31.                      }
  32.                      else
  33.                      {
  34.                         aspectRatioType = "landscape";
  35.                         shortDimension = vImageHeight;
  36.                      }
  37.                      break;
  38.                   case "THUMBNAIL":
  39.                      thumbnailFile = aPath + _loc2_.attributes.file;
  40.                }
  41.                _loc3_ = _loc3_ + 1;
  42.             }
  43.          }
  44.          gotoAndStop(2);
  45.          xmlLoadComplete();
  46.       }
  47.       else
  48.       {
  49.          trace("ERROR: artwork xml failed to load. " + vXmlFile);
  50.       }
  51.    };
  52. }
  53. stop();
  54. var aspectRatioType = "";
  55. var shortDimension = 0;
  56. var imageFile = "";
  57. var thumbnailFile = "";
  58. var vImageWidth;
  59. var vImageHeight;
  60. var ARTWORK_xml;
  61. var o = _root.customArtObjectMatcher.getInfoObject();
  62. loadCustomArtwork(_root.getCustomDirectory(),o.tokenID);
  63.